#include<stdio.h>
int main()
	{
		int a[]={1,2,3,4,5,6,7,8,9};
		int left=0;
		int k=6;
		int sz=sizeof(a)/sizeof(a[0]);
		int right=sz-1;
		int flag=0;
		while(left<=right)
		{
			int mid=(left+right)/2;
			if(a[mid]<k)
			{
				left=mid+1;
			}
			else if(a[mid]>k)
			{
				right=mid-1;
			}
			else
			{
				printf("找到了,其下标是：%d",mid);
				flag=1;
				break;
			}
		}
		if(flag==0)
		{
			printf("找不到了");
		}
		return 0;
	}